package com.mxx.exceltoentity.ui;
import com.intellij.openapi.diagnostic.Logger;
import com.mxx.exceltoentity.print.CalculationPrint;

import javax.swing.*;

public class ReadUI {
    private JTextArea outTextArea;
    private JButton geButton;
    private JPanel mainPanel;
    private JTextArea inTextArea;
    private JLabel num;
    Logger logger= Logger
            .getInstance(ReadUI.class);
    public ReadUI() {
        inTextArea.setText("人员：姓名 年龄 地址");
        // 给按钮添加一个选择文件的事件
        geButton.addActionListener(e -> {
            new Thread(() -> {
                String text = inTextArea.getText();

                String  outStr = null;
                try {
                    outStr = CalculationPrint.printSql(text, num);
                } catch (Exception ex) {
                    logger.error("出错了",ex);
                    throw new RuntimeException("出错了", ex);
                }

                outTextArea.setText(outStr);
            }).start();

        });
    }

    public JPanel getMainPanel() {
        return mainPanel;
    }

    public JTextArea getTextArea2() {
        return outTextArea;
    }

    public JButton getGeButton() {
        return geButton;
    }


}
